package com.major.thread;

public class BooleanMark{

    Boolean run = true;

    public static void main(String[] args) {
        System.out.println("start");
        Thread thread = new Thread(new BooleanThread());
        thread.start();

        try {
            Thread.sleep(3000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        BooleanThread.run = false;
    }
}

class BooleanThread implements Runnable{

    static boolean run = true;

    @Override
    public void run() {
        int i = 0;
        while (run){
            try {
                Thread.sleep(100);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            System.out.println(i);
            i++;
        }
    }
}


